#include "UdpServer.hpp"
#include "Comm.hpp"
#include <memory>
#include <vector>
#include <cstdio>


namespace std {
    template<typename T, typename... Args>
    std::unique_ptr<T> make_unique(Args&&... args) {
        return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
    }
}

void Usage(std::string proc)
{
    //std::cout << "Usage : \n\t" << proc << "local_ip local_port\n" << std::endl;
    std::cout << "Usage : \n\t" << proc << "local_port\n" << std::endl;
}

std::vector<std::string> black_words = {
    "rm",
    "unlink",
    "cp",
    "mv",
    "chmod",
    "exit",
    "reboot",
    "halt",
    "shutdown",
    "top",
    "kill",
    "dd",
    "vim",
    "vi",
    "nano",
    "man"
};



// 1、有ip版本   ./udp_server 127.0.0.1 8888 
// 2、./udp_server 8888

int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        return Usage_Err;
    }

    //std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);

    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(port);
    usvr->Init();
    usvr->Start();
    
    return 0;

}